package net.exoweb.animate.objects
{
    import net.exoweb.animate.objects.DisplayShape;
    import net.exoweb.animate.objects.Vector;

    public class Line extends DisplayShape
    {
        private var _thickness:Number;
        private var _direction:Vector;

        public function Line(v:Vector, thickness:Number=1, color:uint=0xFFFFFF, bm:String="normal")
        {
            super(color, bm);
            _thickness = thickness;
            _direction = new Vector(v.x, v.y);
            display();
        }

        public function set thickness(v:Number):void
        {
            _thickness = v;
            display();
        }

        public function get thickness():Number
        {
            return _thickness;
        }

        public function set direction(v:Vector):void
        {
            _direction.equal(v);
            display();
        }

        public function get direction():Vector
        {
            return _direction;
        }

        override public function display():void
        {
            graphics.clear();
            graphics.lineStyle(_thickness, _color);
            graphics.moveTo(0, 0);
            graphics.lineTo(_direction.x, _direction.y);
        }
    }
}
